
from com.anupam.graphs.GraphSamples import GraphObjects

class BasicGraphNode(object):
  """
    Describes a bare minimum graph node.
  """

  def __init__(self):
    self.children = []
    self.value = None
    self.parents = []


class ColoredGraphNode(BasicGraphNode):
  """
    Describes a colored graph node @see{BasicGraphNode}.
  """

  def __init__(self, name):
    BasicGraphNode.__init__(self)
    self.color = 'white'

class SampleGraphObject(object):

  def __init__(self):
    ## Contianer for the graph node objects.
    self.nodes = {}
    pass

  def biDirGraphSample(self):
    """
      Creates a sample bi directional graph.
    """
    graphSample = GraphObjects()
    graphSample.biDirectionalGraph1()
    names = graphSample.name

    for i in range(0, len(names)):
      self.nodes[names[i]] = ColoredGraphNode(names[i])

    return graphSample.adjucancyList

  def directedGraphSample(self):
      """
        Creates a sample directional graph.
      """
      graphSample = GraphObjects()
      graphSample.directedGraph1()
      names = graphSample.name

      for i in range(0, len(names)):
        self.nodes[names[i]] = ColoredGraphNode(names[i])

      return graphSample.adjucancyList

  def undirectedGraphKruskals(self):
    """
      Creates a sample bi directional graph.
    """
    graphSample = GraphObjects()
    graphSample.biDirectionalGraph2()
    names = graphSample.name

    for i in range(0, len(names)):
      self.nodes[names[i]] = ColoredGraphNode(names[i])

    return graphSample.adjucancyList


if __name__ == '__main__':
  print SampleGraphObject().biDirGraphSample()
  print SampleGraphObject().directedGraphSample()
  print SampleGraphObject().undirectedGraphKruskals()

